import request from '@/utils/request'

// 用户列表
export function getUserList(params: any) {
    return request.get({ url: '/user.user/lists', params }, { ignoreCancelToken: true })
}

// 用户列表
export function getUserGroupAll(params?: any) {
    return request.get({ url: '/user.userGroup/all', params })
}

// 用户详情
export function getUserDetail(params: any) {
    return request.get({ url: '/user.user/detail', params })
}

// 用户编辑
export function userEdit(params: any) {
    return request.post({ url: '/user.user/edit', params })
}

// 用户编辑
export function adjustMoney(params: any) {
    return request.post({ url: '/user.user/adjustAccount', params })
}

// 用户编辑会员时间
export function adjustMember(params: any) {
    return request.post({ url: '/user.user/adjustMember', params })
}

//会员列表
export function getMemberList(params?: any) {
    return request.get({ url: '/member.member_package/commonLists', params })
}

// 调整用户视频合成时长
export function adjustVideo(params: any) {
    return request.post({ url: '/user.user/adjustAccount', params })
}

//创建用户
export function addUser(params: any) {
    return request.post({ url: '/user.user/add', params })
}

//黑名单
export function blackList(params: any) {
    return request.post({ url: '/user.user/blacklist', params })
}

//重置密码
export function resetPassword(params: any) {
    return request.post({ url: '/user.user/rePassword', params })
}

//会员开通记录
export function getOpenVipRecord(params: { user_id: number }) {
    return request.get({ url: '/user.user/buyLog', params })
}

// 注销账号
export function userCancelled(params: { user_id: number }) {
    return request.post({ url: '/user.user/cancelled', params })
}

export function setRegisterReward(params: any) {
    return request.post({ url: '/market.regReward/save', params })
}

export function getRegisterReward() {
    return request.get({ url: '/market.regReward/detail' })
}

//用户分组列表
export function userGroupingList(params: any) {
    return request.get({ url: '/user.userGroup/lists', params })
}

//用户分组新增
export function userGroupingAdd(params: any) {
    return request.post({ url: '/user.userGroup/add', params })
}
//用户分组编辑
export function userGroupingEdit(params: any) {
    return request.post({ url: '/user.userGroup/edit', params })
}
//用户分组删除
export function userGroupingDel(params: any) {
    return request.post({ url: '/user.userGroup/del', params })
}

//设置分组
export function userGroupingset(params: any) {
    return request.post({ url: '/user.user/setGroup', params })
}

//调整智能体
export function adjustRobot(params: any) {
    return request.post({ url: '/user.user/adjustRobot', params })
}

//调整智能体
export function adjustKb(params: any) {
    return request.post({ url: '/user.user/adjustKb', params })
}

// 调整分销
export function adjustLeader(params?: any) {
    return request.post({ url: '/user.user/adjustLeader', params })
}

// 教师管理列表
export function getTeacherList(params: any) {
    console.log('getTeacherListgetTeacherList')

    return request.post({ url: '/school.teacher/teacherList', params })
}

// 创建老师
export function addTeacher(params: any) {
    return request.post({ url: '/school.teacher/addTeacher', params })
}

// 编辑老师
export function editTeacher(params: any) {
    return request.post({ url: '/school.teacher/editTeacher', params })
}

// 删除老师
export function delTeacher(params: any) {
    return request.post({ url: '/school.teacher/delTeacher', params })
}

// 老师详情
export function getTeacherDetail(params: any) {
    return request.post({ url: '/school.teacher/showTeacher', params })
}
// 上传图片
export function uploadImage(params: any) {
    // 上传文件写法

    const formData = new FormData()

    Object.keys(params).forEach((key) => {
        formData.append(key, params[key])
    })

    console.log('formData',formData);
    

    return request.post(
        {
            url: '/upload/file',
            data: formData,
            axiosHooks: {
                requestInterceptorsHook: (config) => {
                    console.log('configconfigconfigconfigconfig',config);
                    
                    config.headers['Content-Type'] = 'multipart/form-data'
                    return config
                }
            }
        },
        {
            // requestInterceptorsHook : (config) => {
            //     config.headers['Content-Type'] = 'multipart/form-data'
            //     return config
            // }
        }
        // {
        //     headers: {
        //         'Content-Type': 'multipart/form-data'
        //     }
        // }
    )
}

// 学生列表
export function getStudentList(params: any) {
    return request.post({ url: '/school.student/studentList/studentList', params })
}

// 学院列表
export function getDepartmentList(params: any) {
    return request.post({ url: '/school.college/collegeList', params })
}

// 添加学院
export function addDepartment(params: any) {
    return request.post({ url: '/admin/college/addCollege', params })
}

// 删除学院
export function delDepartment(params: any) {
    return request.post({ url: '/admin/college/delCollege', params })
}

// 编辑学院
export function editDepartment(params: any) {
    return request.post({ url: '/admin/college/editCollege', params })
}

// 班级列表
export function getClassList(params: any) {
    return request.post({ url: '/school.classes/classesList', params })
}

// 删除班级
export function delClass(params: any) {
    return request.post({ url: '/school.classes/delClasses', params })
}

// 新增班级i
export function addClass(params: any) {
    return request.post({ url: '/school.classes/addClasses', params })
}

// 编辑班级
export function editClass(params: any) {
    return request.post({ url: '/school.classes/editClasses', params })
}

// 新增学生
export function addStudent(params: any) {
    return request.post({ url: '/school.student/studentList/addStudent', params })
}

// 更新学生
export function editStudent(params: any) {
    return request.post({ url: '/school.student/studentList/editStudent', params })
}

export function delStudent(params: any) {
    return request.post({ url: '/school.student/studentList/delStudent', params })
}

// 学生详情
export function getStudentDetail(params: any) {
    return request.post({ url: '/school.student/showStudent', params })
}

// 对话历史
export function getHistoryList(params: any) {
    return request.post({ url: '/school.Works/dialogueList', params })
}

// 获取角色模型列表
export function getRoleModelList(params: any) {
    return request.post({ url: '/school.Works/skillList', params })
}

// 对话模型列表
export function getDialogueModelList(params: any) {
    return request.post({ url: '/school.Works/modelsList', params })
}

// 创作记录
export function getCreatRecord(params: any) {
    return request.post({ url: '/school.Works/creationList', params })
}

/* 绘画作品记录 */
export function getPaintRecord(params: any) {
    return request.post({ url: '/school.Works/drawList', params })
}

// 作品详情
export function getWorksDetail(params: any) {
    return request.post({ url: '/school.Works/drawDetail', params })
}

// 导入学生，上传文件
export function uploadStudent(params: any) {
    return request.post({ url: '/school.student/importStudent' }, params)
}
